package com.ciwong.epaper.modules.viedoexplantion.util;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.ciwong.epaper.application.EpaperConstant;
import com.ciwong.epaper.modules.cordva.VideoExplainOnlineAnswerResultActivity;
import com.ciwong.epaper.modules.epaper.bean.Answer;
import com.ciwong.epaper.modules.epaper.bean.Module;
import com.ciwong.epaper.modules.epaper.ui.ListenSpeakVideoActivity;
import com.ciwong.epaper.util.IntentFlag;
import com.ciwong.mobilelib.utils.BaseJumpManager;

/**
 * Created by young on 2016/7/6.
 * 视频解析模块跳转类
 */
public class ViedoJumpManager extends BaseJumpManager {
    /**
     * @param goBackId
     * @param context
     * @param requestCode
     * @param type
     * @param workId
     * @param module
     * @param position
     * @param doWorkId
     * @param resubmit           重新提交
     * @param totalTime
     * @param score
     * @param pageType
     * @param serviceId
     * @param classId
     * @param submitFailedAnswer
     */
    public static void jumpToResultActivityAgain(int goBackId, Activity context, int requestCode, int type, String workId, Module module, int position, String doWorkId, boolean resubmit, int totalTime, String score, int pageType, int serviceId, String classId, Answer submitFailedAnswer) {
        Intent intent = getBaseIntent(goBackId, context, VideoExplainOnlineAnswerResultActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_TYPE, type);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_ID, workId);
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, module);
        intent.putExtra(IntentFlag.INTENT_FLAG_POSITION, position);
        intent.putExtra(IntentFlag.INTENT_FLAG_DO_WORK_ID, doWorkId);
        intent.putExtra(IntentFlag.INTENT_FLAG_RESUBMIT, resubmit);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_TIME, totalTime);
        intent.putExtra(IntentFlag.INTENT_FLAG_WORK_SCORE, score);
        intent.putExtra(IntentFlag.INTENT_FLAG_H5_PAGE_TYPE_SOURCE, pageType);
        intent.putExtra(IntentFlag.INTENT_FLAG_SERVICE_ID, serviceId);
        intent.putExtra(IntentFlag.INTENT_FLAG_CLASS_ID, classId);
        intent.putExtra(IntentFlag.INTENT_FLAG_ANSWER, submitFailedAnswer);
        context.startActivityForResult(intent, requestCode);
    }


    /**
     * 跳转到添加书籍
     *
     * @param goBackId    返回按钮的文字id
     * @param act         启动activity
     * @param requestCode 返回码
     */
    public static void jumpToListenSpeakVideo(int goBackId, Activity act, int requestCode, String vuid, int playType, String recorderPath, String title, String bigStem)//
    {
        Intent intent = getBaseIntent(goBackId, act, ListenSpeakVideoActivity.class);
        Bundle mBundle = new Bundle();
        mBundle.putInt(ListenSpeakVideoActivity.KEY_PLAY_TYPE, playType);
        if (playType == EpaperConstant.LISTEN_SPEAK_PLAY_TYPE_NEED_RECORD) {
            mBundle.putString(ListenSpeakVideoActivity.KEY_RECORDER_PATH, recorderPath);

        } else if (playType == EpaperConstant.LISTEN_SPEAK_PLAY_TYPE_NO_NEED_RECORD) {
        }
        intent.putExtra(IntentFlag.INTENT_FLAG_OBJ, mBundle);
        intent.putExtra(ListenSpeakVideoActivity.KEY_TITLE, title);
        intent.putExtra(ListenSpeakVideoActivity.KEY_QUE_STEM, bigStem);

        act.startActivityForResult(intent, requestCode);
    }
}
